<template>
    <mescroll-uni @init="mescrollInit" :height="height" :down="downOption" @down="refresh" :up="upOption" @up="getData">
        <!-- 数据列表 -->
        <order-item :key="index" v-for="(item, index) in datas" :data="item" @selProject="selProject"></order-item>
    </mescroll-uni>
</template>

<script>
import orderItem from "@/pages_me/components/project/order-list-item.vue"
import { GetUsableOrderList } from "@/service/api/order.js"
export default {
    props: {
        height: {
            type: String,
            default: "100px",
        },
        state: {
            type: String,
            default: "-1",
        },
        requestData: {
            type: Object,
            default: {},
        },
    },
    components: {
        orderItem,
    },
    data() {
        return {
            downOption: {
                use: true,
            },
            datas: [],
            param: {},
        }
    },
    mounted() {},
    methods: {
        getData(page) {
            let param = this.requestData
            param.pageSize = page.size
            param.pageIndex = page.num
            GetUsableOrderList(param).then((res) => {
                this.mescroll.endBySize(res.Data.length, res.RecordAmout)
                this.datas = this.datas.concat(res.Data)
            })
        },
        refresh(requestData) {
            this.param = requestData
            this.datas = []
            this.mescroll.resetUpScroll()
        },
        selProject(data) {
            this.$emit("selProject", data)
        },
    },
}
</script>

<style lang="scss"></style>
